package com.bbcare.followup.plat.store.ibatis;

import com.bbcare.followup.plat.dto.bo.PatientListBO;
import com.bbcare.followup.plat.entity.Patient;
import com.bbcare.followup.plat.entity.PatientContentData;
import com.bbcare.followup.plat.entity.Tguidance;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @name: 患者信息存储接口
 * @author: DemonLee
 * @createTime: 2017.4.11
 * @description: 患者基本信息
 * @modify:
 *
 */
public interface IPatientDAO {
    /**
     * 查询患者list
     *
     * @param 定制
     * @return list
     */
    public List<Patient> select(Map<String, Object> paramMap) throws Exception;

    /**
     * 查询患者list
     *
     * @param PhoneNO
     *            服务号码
     * @return list
     */
    public List<Patient> selectByPhoneNo(Map<String, Object> paramMap) throws Exception;
    public List<Patient> selectByBirthdayAndName(Map<String, Object> paramMap) throws Exception;

    //根据微信查询用户信息
    public List<Patient> selectByWechatId(Map<String, Object> paramMap) throws Exception;

    /**
     * 添加患者
     *
     * @param Patient
     * @return
     */
    public void savePatientInfo(Patient pt) throws Exception;

    /**
     * 入患者his表
     *
     * @param Patient
     * @return
     */
    public void savePatientHisInfo(Map<String, Object> paramMap) throws Exception;

    /**
     * 查询患者list
     *
     * @param 定制
     * @return list
     */
    Patient selectById(Map<String, Object> paramMap) throws Exception;

    /**
     * 查询患者list和患者队列实例id
     *
     * @param PhoneNO,queueId
     * @return list
     */
    public List<Map<String, Object>> selectPtSchemeAndPatientByPhoneAndQueueId(Map<String, Object> paramMap)
            throws Exception;

    /**
     * 查询患者list和患者队列实例id
     *
     * @param PhoneNO,queueId
     * @return list
     */
    public List<Map<String, Object>> listPtArchInfoByCondition(Map<String, Object> paramMap) throws Exception;

    /**
     * 查询患者list
     *
     * @param 门诊号
     * @return list
     */
    public List<Map<String, Object>> selectDataByOutNo(Map<String, Object> paramMap) throws Exception;

    /**
     * 更新患者信息
     *
     * @param 门诊号
     * @return list
     */
    public void modDataByOutNo(Map<String, Object> paramMap) throws Exception;

    /**
     * 查询患者list
     *
     * @param 服务号码
     * @return list
     */
    public List<Map<String, Object>> selectcardinfo(Map<String, Object> paramMap) throws Exception;

    /**
     * 更新微信id
     *
     * @param 患者id
     * @return null
     */
    public void updateWechatId(Map<String, Object> paramMap) throws Exception;

    /**
     * 查询表字段
     *
     * @param id
     * @return null
     */
    public Map<String, Object> selectoutTableInfo(Map<String, Object> map) throws Exception;

    /**
     * 更新患者
     *
     * @param map
     * @return
     */
    public void updatePatientInfoById(Map<String, Object> map) throws Exception;

    /**
     * 保存国妇婴项目用户信息
     *
     * @param map
     * @return
     */
    public void savetrbkfjbxxInfo(Map<String, Object> map) throws Exception;

    public void insertIntooutTableInfo(Map<String, Object> map) throws Exception;

    public void updateoutTableByid(Map<String, Object> map) throws Exception;

    /**
     * 查询患者list和患者队列实例id
     *
     * @param PhoneNO,queueId
     * @return list
     */
    public List<Map<String, Object>> selectPtSchemeByCondition(Map<String, Object> paramMap) throws Exception;

    //查询的当天建档用户数量
    public int selectTotalDayCreate(Map<String, Object> paramMap) throws Exception;


    /**
     * 批量插入指导意见
     *
     * @param List
     * @return
     */
    public int savetGuidance(List<Tguidance> pt) throws Exception;

    /**
     * 查询指导意见
     *
     * @param List
     * @return
     */
    public List<Tguidance> selecttGuidance(Map<String,Object> map) throws Exception;
    /**
     * 发送短信时修改发送状态(避免重复发送)
     */
    public int updatetGuidance(String id) throws Exception;
    /**
     * 通过创建时间查询当天要发送短信的数据
     */
    public List<Tguidance> listtGuidances(String createDate) ;

    /**
     *
     * Edit by jiangq on 2022年01月18日
     * 近12个月用户数量
     * @param tenantId
     * @return
     */
    List<Map<String, Object>> calcRecentUsers(@Param("tenantId") String tenantId);

    /**
     * 患者列表查询
     * @param reqDTO 查询条件
     * @return 患者列表
     */
    List<PatientListBO> selectList(Map<String,Object> reqDTO);

    List<PatientListBO> selectMilkPreparation(Map<String,Object> reqDTO);

    Patient selectByPhoneNoAndQueueId(Map<String, Object> paramMap);

    //根据患者id查询患者最近一次随访内容
    List<PatientContentData> queryPatientRecentlyFollowRecord(Map<String, Object> map);

    void updateAccessStatus(@Param("userId") String userId, @Param("accessStatus") String accessStatus);
}


